
/**
 * 用户信息
 */
export interface User {
  id: number;
  username: string;
  email: string;
  phone?: string;
  nickname?: string;
  gender: 0 | 1 | 2; // 0-未知，1-男，2-女
  genderText: string;
  birthday?: string;
  status: 0 | 1; // 0-禁用，1-正常
  statusText: string;
  levelId: number;
  points: number;
  balance: number;
  lastLoginAt?: string;
  createdAt: string;
  updatedAt: string;
}

/**
 * 用户查询参数
 */
export interface UserQueryParams {
  page?: number;
  limit?: number;
  keyword?: string;
  status?: 0 | 1;
  gender?: 0 | 1 | 2;
  levelId?: number;
  startDate?: string;
  endDate?: string;
  sortBy?: 'id' | 'username' | 'email' | 'createdAt' | 'lastLoginAt' | 'points' | 'balance';
  sortOrder?: 'ASC' | 'DESC';
}

/**
 * 用户列表响应
 */
export interface UserListResponse {
  users: User[];
  pagination: {
    page: number;
    limit: number;
    total: number;
    totalPages: number;
  };
}

/**
 * 创建用户请求
 */
export interface CreateUserRequest {
  username: string;
  email: string;
  password: string;
  phone?: string;
  nickname?: string;
  gender?: 0 | 1 | 2;
  birthday?: string;
}

/**
 * 更新用户请求
 */
export interface UpdateUserRequest {
  username?: string;
  email?: string;
  phone?: string;
  nickname?: string;
  gender?: 0 | 1 | 2;
  birthday?: string;
  status?: 0 | 1;
  levelId?: number;
  points?: number;
  balance?: number;
}

/**
 * 用户地址
 */
export interface UserAddress {
  id: number;
  userId: number;
  receiverName: string;
  receiverPhone: string;
  province: string;
  city: string;
  district: string;
  address: string;
  fullAddress: string;
  postalCode?: string;
  isDefault: 0 | 1;
  isDefaultText: string;
  createdAt: string;
  updatedAt: string;
}

/**
 * 创建用户地址请求
 */
export interface CreateUserAddressRequest {
  receiverName: string;
  receiverPhone: string;
  province: string;
  city: string;
  district: string;
  address: string;
  postalCode?: string;
  isDefault?: 0 | 1;
}

/**
 * 更新用户地址请求
 */
export interface UpdateUserAddressRequest {
  receiverName?: string;
  receiverPhone?: string;
  province?: string;
  city?: string;
  district?: string;
  address?: string;
  postalCode?: string;
  isDefault?: 0 | 1;
}

/**
 * 用户统计信息
 */
export interface UserStatsResponse {
  totalUsers: number;
  activeUsers: number;
  inactiveUsers: number;
  newUsersToday: number;
  newUsersThisWeek: number;
  newUsersThisMonth: number;
  genderDistribution: {
    unknown: number;
    male: number;
    female: number;
  };
  levelDistribution: {
    [key: string]: number;
  };
}